#ifndef EVENTLISTENER_H
#define EVENTLISTENER_H

#include <QObject>
#include <QtCore/QTimer>
#include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkReply>
#include <QtNetwork/QNetworkAccessManager>
#include <QtCore/QList>
#include "shard.h"
#include "zone.h"

class EventListener : public QObject
{
  Q_OBJECT
  Q_PROPERTY(Shard shard READ shard WRITE setShard)
public:
  explicit EventListener(QObject *parent = 0);
  Shard shard();
  void setShard(const Shard &s);

signals:
  void parsedEventData(QList<Zone> list);

public slots:
  void init();
  void done();
  void tick();
  void parse(QNetworkReply* reply);

private:
  QTimer* timer;
  QUrl* url;
  QNetworkRequest* request;
  QNetworkAccessManager* manager;

  Shard s;
};

#endif // EVENTLISTENER_H
